package com.mvd.app.ac_wenzhou;

import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gson.Gson;
import com.kongzue.dialog.interfaces.OnMenuItemClickListener;
import com.kongzue.dialog.v3.BottomMenu;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.lzy.okgo.request.base.Request;
import com.mvd.app.R;
import com.mvd.app.activity.BaseActivity;
import com.mvd.app.application.BaseApplication;
import com.mvd.app.commons.JsonUtil;
import com.mvd.app.commons.PDALogUtils;
import com.mvd.app.commons.SharedPreferencesUtils;
import com.mvd.app.commons.UtilsLog;
import com.mvd.app.model.HbInsertPublicInfoModel;
import com.mvd.app.model.HbSearchPublicInfoModel;
import com.mvd.app.model.HuanBaoModel;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class HbPubInfoActivity extends BaseActivity {
    @BindView(R.id.include_huan_tv_ecuModel)
    EditText includeHuanTvEcuModel;
    @BindView(R.id.include_huan_check_ecuModel)
    TextView includeHuanCheckEcuModel;
    @BindView(R.id.include_huan_tv_converterModel)
    EditText includeHuanTvConverterModel;
    @BindView(R.id.include_huan_check_converterModel)
    TextView includeHuanCheckConverterModel;
    @BindView(R.id.include_huan_tv_bujiqiModel)
    EditText includeHuanTvBujiqiModel;
    @BindView(R.id.include_huan_check_bujiqiModel)
    TextView includeHuanCheckBujiqiModel;
    @BindView(R.id.include_huan_tv_tanguanModel)
    EditText includeHuanTvTanguanModel;
    @BindView(R.id.include_huan_check_tanguanModel)
    TextView includeHuanCheckTanguanModel;
    @BindView(R.id.include_huan_tv_yangchuanganqiModel)
    EditText includeHuanTvYangchuanganqiModel;
    @BindView(R.id.include_huan_check_yangchuanganqiModel)
    TextView includeHuanCheckYangchuanganqiModel;
    @BindView(R.id.include_huan_tv_egrModel)
    EditText includeHuanTvEgrModel;
    @BindView(R.id.include_huan_check_egrModel)
    TextView includeHuanCheckEgrModel;
    @BindView(R.id.include_huan_tv_zengyaqiModel)
    EditText includeHuanTvZengyaqiModel;
    @BindView(R.id.include_huan_check_zengyaqiModel)
    TextView includeHuanCheckZengyaqiModel;
    @BindView(R.id.include_huan_layout_qiyou)
    LinearLayout includeHuanLayoutQiyou;
    @BindView(R.id.include_huan_cy_tv_ecuModel)
    EditText includeHuanCyTvEcuModel;
    @BindView(R.id.include_huan_cy_check_ecuModel)
    TextView includeHuanCyCheckEcuModel;
    @BindView(R.id.include_huan_cy_tv_penyoubengModel)
    EditText includeHuanCyTvPenyoubengModel;
    @BindView(R.id.include_huan_cy_check_penyoubengModel)
    TextView includeHuanCyCheckPenyoubengModel;
    @BindView(R.id.include_huan_cy_tv_penyouqiModel)
    EditText includeHuanCyTvPenyouqiModel;
    @BindView(R.id.include_huan_cy_check_penyouqiModel)
    TextView includeHuanCyCheckPenyouqiModel;
    @BindView(R.id.include_huan_cy_tv_gongguiguanModel)
    EditText includeHuanCyTvGongguiguanModel;
    @BindView(R.id.include_huan_cy_check_gongguiguanModel)
    TextView includeHuanCyCheckGongguiguanModel;
    @BindView(R.id.include_huan_cy_tv_zengyaqiModel)
    EditText includeHuanCyTvZengyaqiModel;
    @BindView(R.id.include_huan_cy_check_zengyaqiModel)
    TextView includeHuanCyCheckZengyaqiModel;
    @BindView(R.id.include_huan_cy_tv_egrModel)
    EditText includeHuanCyTvEgrModel;
    @BindView(R.id.include_huan_cy_check_egrModel)
    TextView includeHuanCyCheckEgrModel;
    @BindView(R.id.include_huan_cy_tv_docModel)
    EditText includeHuanCyTvDocModel;
    @BindView(R.id.include_huan_cy_check_docModel)
    TextView includeHuanCyCheckDocModel;
    @BindView(R.id.include_huan_cy_tv_pocModel)
    EditText includeHuanCyTvPocModel;
    @BindView(R.id.include_huan_cy_check_pocModel)
    TextView includeHuanCyCheckPocModel;
    @BindView(R.id.include_huan_cy_tv_scrModel)
    EditText includeHuanCyTvScrModel;
    @BindView(R.id.include_huan_cy_check_scrModel)
    TextView includeHuanCyCheckScrModel;
    @BindView(R.id.include_huan_cy_tv_ascModel)
    EditText includeHuanCyTvAscModel;
    @BindView(R.id.include_huan_cy_check_ascModel)
    TextView includeHuanCyCheckAscModel;
    @BindView(R.id.include_huan_cy_tv_dpfModel)
    EditText includeHuanCyTvDpfModel;
    @BindView(R.id.include_huan_cy_check_dpfModel)
    TextView includeHuanCyCheckDpfModel;
    @BindView(R.id.include_huan_layout_chaiyou)
    LinearLayout includeHuanLayoutChaiyou;
    @BindView(R.id.include_huan_isOpen)
    TextView includeHuanIsOpen;
    @BindView(R.id.include_huan_checkResult)
    TextView includeHuanCheckResult;
    @BindView(R.id.include_huan_layout_zhuce)
    LinearLayout includeHuanLayoutZhuce;
    @BindView(R.id.huan_pub_info_commit)
    Button huanPubInfoCommit;
    private HbPubInfoActivity instances;
    private String DetectionCategory;
    private String PublicInfoNum;
    private String Trademark;
    private String DischargeStage;
    private HuanBaoModel huanBaoModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hb_pub_info);
        ButterKnife.bind(this);
        setBackBtn();
        setTopTitle("环保公开信息");
        instances = this;
        huanBaoModel = (HuanBaoModel) getIntent().getSerializableExtra("huanBaoModel");
        String logStr = "---HbPubInfoActivity----huanBaoModel====" + huanBaoModel;
        Log.e("tag", logStr);
        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
        String fuelType = huanBaoModel.getFuelType();
        Log.e("tag", "fuelType=====" + fuelType);
        if (fuelType != null && fuelType.contains("A")) {
            //汽油车
            includeHuanLayoutQiyou.setVisibility(View.VISIBLE);
            includeHuanLayoutZhuce.setVisibility(View.VISIBLE);
        } else if (fuelType != null && fuelType.contains("B")) {
            //柴油车
            includeHuanLayoutChaiyou.setVisibility(View.VISIBLE);
            includeHuanLayoutZhuce.setVisibility(View.VISIBLE);
        }
        searchPublicInfo(huanBaoModel);
    }

    @OnClick({R.id.include_huan_check_ecuModel, R.id.include_huan_check_converterModel,
            R.id.include_huan_check_bujiqiModel, R.id.include_huan_check_tanguanModel,
            R.id.include_huan_check_yangchuanganqiModel, R.id.include_huan_check_egrModel,
            R.id.include_huan_check_zengyaqiModel, R.id.include_huan_layout_qiyou,
            R.id.include_huan_cy_check_ecuModel, R.id.include_huan_cy_check_penyoubengModel,
            R.id.include_huan_cy_check_penyouqiModel, R.id.include_huan_cy_check_gongguiguanModel,
            R.id.include_huan_cy_check_zengyaqiModel, R.id.include_huan_cy_check_egrModel,
            R.id.include_huan_cy_check_docModel, R.id.include_huan_cy_check_pocModel,
            R.id.include_huan_cy_check_scrModel, R.id.include_huan_cy_check_ascModel,
            R.id.include_huan_cy_check_dpfModel, R.id.include_huan_layout_chaiyou,
            R.id.include_huan_isOpen, R.id.include_huan_checkResult,
            R.id.include_huan_layout_zhuce, R.id.huan_pub_info_commit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.include_huan_check_ecuModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_check_ecuModel);
                break;
            case R.id.include_huan_check_converterModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_check_converterModel);
                break;
            case R.id.include_huan_check_bujiqiModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_check_bujiqiModel);
                break;
            case R.id.include_huan_check_tanguanModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_check_tanguanModel);
                break;
            case R.id.include_huan_check_yangchuanganqiModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_check_yangchuanganqiModel);
                break;
            case R.id.include_huan_check_egrModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_check_egrModel);
                break;
            case R.id.include_huan_check_zengyaqiModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_check_zengyaqiModel);
                break;
            case R.id.include_huan_cy_check_ecuModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_ecuModel);
                break;
            case R.id.include_huan_cy_check_penyoubengModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_penyoubengModel);
                break;
            case R.id.include_huan_cy_check_penyouqiModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_penyouqiModel);
                break;
            case R.id.include_huan_cy_check_gongguiguanModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_gongguiguanModel);
                break;
            case R.id.include_huan_cy_check_zengyaqiModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_zengyaqiModel);
                break;
            case R.id.include_huan_cy_check_egrModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_egrModel);
                break;
            case R.id.include_huan_cy_check_docModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_docModel);
                break;
            case R.id.include_huan_cy_check_pocModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_pocModel);
                break;
            case R.id.include_huan_cy_check_scrModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_scrModel);
                break;
            case R.id.include_huan_cy_check_ascModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_ascModel);
                break;
            case R.id.include_huan_cy_check_dpfModel:
                showHuanDialog(huan_verdict_str, R.id.include_huan_cy_check_dpfModel);
                break;
            case R.id.include_huan_isOpen:
                showHuanDialog(shi_fou_str, R.id.include_huan_isOpen);
                break;
            case R.id.include_huan_checkResult:
                showHuanDialog(shi_fou_str, R.id.include_huan_checkResult);
                break;
            case R.id.huan_pub_info_commit:
                insertPublicInfo(huanBaoModel);
                break;
        }
    }

    private void searchPublicInfo(HuanBaoModel model_huan) {
        String VIN = model_huan.getVIN();
        SearchModel model = new SearchModel();
        model.setVIN(VIN);
        Gson gson = new Gson();
        String jsonStr = gson.toJson(model);
        String logStr = "环保--获取公开信息----jsonStr===" + jsonStr + "\n" + "URL::" + SharedPreferencesUtils.getIP(this) + SERACH_PUBLIC_INFO;
        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
        OkGo.<String>post(SharedPreferencesUtils.getIP(this) + SERACH_PUBLIC_INFO).tag(this)
                .upJson(jsonStr)
                .execute(new StringCallback() {
                    @Override
                    public void onStart(Request<String, ? extends Request> request) {
                        super.onStart(request);
                    }

                    @Override
                    public void onSuccess(Response<String> response) {
                        String result = response.body();
                        String newResult = result.substring(1, result.length() - 1).replaceAll("\\\\", "");
                        String logStr = "环保--获取公开信息--请求成功---result::" + result + "\n" + "newResult::" + newResult;
                        Log.e("tag", logStr);
                        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
                        if (!TextUtils.isEmpty(newResult) && !"[[]]".equals(newResult) && !"[{}]".equals
                                (newResult) && !"[]".equals(newResult)) {
                            List<HbSearchPublicInfoModel> models = new ArrayList<HbSearchPublicInfoModel>();
                            models = JsonUtil.stringToArray(newResult, HbSearchPublicInfoModel[].class);
                            PublicInfoNum = models.get(0).getPublicInfoNum();
                            Trademark = models.get(0).getTrademark();
                            DischargeStage = models.get(0).getDischargeStage();
                            if (model_huan.getFuelType().contains("A")) {
                                String Q_ECUModel = models.get(0).getQ_ECUModel();
                                String Q_SCRModel = models.get(0).getQ_SCRModel();
                                String Q_DPFModel = models.get(0).getQ_DPFModel();
                                String Q_EGRModel = models.get(0).getQ_EGRModel();
                                String Q_SuperchargerModel = models.get(0).getQ_SuperchargerModel();
                                String Q_CanisterModel = models.get(0).getQ_CanisterModel();
                                String Q_EGOModel = models.get(0).getQ_EGOModel();
                                includeHuanTvEcuModel.setText(Q_ECUModel);
                                includeHuanTvConverterModel.setText(Q_SCRModel);
                                includeHuanTvBujiqiModel.setText(Q_DPFModel);
                                includeHuanTvEgrModel.setText(Q_EGRModel);
                                includeHuanTvZengyaqiModel.setText(Q_SuperchargerModel);
                                includeHuanTvTanguanModel.setText(Q_CanisterModel);
                                includeHuanTvYangchuanganqiModel.setText(Q_EGOModel);

                            } else if (model_huan.getFuelType().contains("B")) {
                                String C_ECUModel = models.get(0).getC_ECUModel();
                                String C_OilPumpModel = models.get(0).getC_OilPumpModel();
                                String C_InjectionModel = models.get(0).getC_InjectionModel();
                                String C_RailModel = models.get(0).getC_RailModel();
                                String C_SuperchargerModel = models.get(0).getC_SuperchargerModel();
                                String C_EGRModel = models.get(0).getC_EGRModel();
                                String C_DOCModel = models.get(0).getC_DOCModel();
                                String C_POCModel = models.get(0).getC_POCModel();
                                String C_SCRModel = models.get(0).getC_SCRModel();
                                String C_DPFModel = models.get(0).getC_DPFModel();
                                String C_ASCModel = models.get(0).getC_ASCModel();
                                includeHuanCyTvEcuModel.setText(C_ECUModel);
                                includeHuanCyTvPenyoubengModel.setText(C_OilPumpModel);
                                includeHuanCyTvPenyouqiModel.setText(C_InjectionModel);
                                includeHuanCyTvGongguiguanModel.setText(C_RailModel);
                                includeHuanCyTvZengyaqiModel.setText(C_SuperchargerModel);
                                includeHuanCyTvEgrModel.setText(C_EGRModel);
                                includeHuanCyTvDocModel.setText(C_DOCModel);
                                includeHuanCyTvPocModel.setText(C_POCModel);
                                includeHuanCyTvScrModel.setText(C_SCRModel);
                                includeHuanCyTvDpfModel.setText(C_DPFModel);
                                includeHuanCyTvAscModel.setText(C_ASCModel);
                            }
                        } else {
                            Toast.makeText(instances, "无环保信息", Toast.LENGTH_LONG).show();
                        }
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        String logStr = "\n" + "-----环保--获取公开信息--请求失败--onError-" + "\n"
                                + "data::" + response.body();
                        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
//                        UtilsLog.e(instances.getClass().getName() + "获取公开信息-onError==" + response.body());
                        Toast.makeText(instances, "获取公开信息请求失败", Toast
                                .LENGTH_LONG).show();
                    }
                });

    }

    private void insertPublicInfo(HuanBaoModel model_huan) {
        String Q_ECUModel = includeHuanTvEcuModel.getText().toString();
        String Q_ECUModelVerdict = includeHuanCheckEcuModel.getText().toString();
        String Q_SCRModel = includeHuanTvConverterModel.getText().toString();
        String Q_SCRModelVerdict = includeHuanCheckConverterModel.getText().toString();
        String Q_DPFModel = includeHuanTvBujiqiModel.getText().toString();
        String Q_DPFModelVerdict = includeHuanCheckBujiqiModel.getText().toString();
        String Q_EGRModel = includeHuanTvEgrModel.getText().toString();
        String Q_EGRModelVerdict = includeHuanCheckEgrModel.getText().toString();
        String Q_SuperchargerModel = includeHuanTvZengyaqiModel.getText().toString();
        String Q_SuperchargerModelVerdict = includeHuanCheckZengyaqiModel.getText().toString();
        String Q_CanisterModel = includeHuanTvTanguanModel.getText().toString();
        String Q_CanisterModelVerdict = includeHuanCheckTanguanModel.getText().toString();
        String Q_EGOModel = includeHuanTvYangchuanganqiModel.getText().toString();
        String Q_EGOModelVerdict = includeHuanCheckYangchuanganqiModel.getText().toString();
        String C_ECUModel = includeHuanCyTvEcuModel.getText().toString();
        String C_ECUModelVerdict = includeHuanCyCheckEcuModel.getText().toString();
        String C_OilPumpModel = includeHuanCyTvPenyoubengModel.getText().toString();
        String C_OilPumpModelVerdict = includeHuanCyCheckPenyoubengModel.getText().toString();
        String C_InjectionModel = includeHuanCyTvPenyouqiModel.getText().toString();
        String C_InjectionModelVerdict = includeHuanCyCheckPenyouqiModel.getText().toString();
        String C_RailModel = includeHuanCyTvGongguiguanModel.getText().toString();
        String C_RailModelVerdict = includeHuanCyCheckGongguiguanModel.getText().toString();
        String C_SuperchargerModel = includeHuanCyTvZengyaqiModel.getText().toString();
        String C_SuperchargerModelVerdict = includeHuanCyCheckZengyaqiModel.getText().toString();
        String C_EGRModel = includeHuanCyTvEgrModel.getText().toString();
        String C_EGRModelVerdict = includeHuanCyCheckEgrModel.getText().toString();
        String C_DOCModel = includeHuanCyTvDocModel.getText().toString();
        String C_DOCModelVerdict = includeHuanCyCheckDocModel.getText().toString();
        String C_POCModel = includeHuanCyTvPocModel.getText().toString();
        String C_POCModelVerdict = includeHuanCyCheckPocModel.getText().toString();
        String C_SCRModel = includeHuanCyTvScrModel.getText().toString();
        String C_SCRModelVerdict = includeHuanCyCheckScrModel.getText().toString();
        String C_DPFModel = includeHuanCyTvDpfModel.getText().toString();
        String C_DPFModelVerdict = includeHuanCyCheckDpfModel.getText().toString();
        String C_ASCModel = includeHuanCyTvAscModel.getText().toString();
        String C_ASCModelVerdict = includeHuanCyCheckAscModel.getText().toString();
        String ListVerdict = includeHuanIsOpen.getText().toString();
        String ControlVerdict = includeHuanCheckResult.getText().toString();
        String publicInfoNum = PublicInfoNum == null ? "" : PublicInfoNum;
        String trademark = Trademark == null ? "" : Trademark;
        String dischargeStage = DischargeStage == null ? "" : DischargeStage;
        HbInsertPublicInfoModel model = new HbInsertPublicInfoModel();
        model.setDetection_ID(model_huan.getID());
        model.setGUID(model_huan.getGUID());
        model.setTimes(model_huan.getTimes());
        model.setUpdateTime(model_huan.getUpdateTime());
        model.setPublicInfoNum(publicInfoNum);
        model.setTrademark(trademark);
        model.setDischargeStage(dischargeStage);
        model.setQ_ECUModel(Q_ECUModel);
        model.setQ_ECUModelVerdict(Q_ECUModelVerdict);
        model.setQ_SCRModel(Q_SCRModel);
        model.setQ_SCRModelVerdict(Q_SCRModelVerdict);
        model.setQ_DPFModel(Q_DPFModel);
        model.setQ_DPFModelVerdict(Q_DPFModelVerdict);
        model.setQ_EGRModel(Q_EGRModel);
        model.setQ_EGRModelVerdict(Q_EGRModelVerdict);
        model.setQ_SuperchargerModel(Q_SuperchargerModel);
        model.setQ_SuperchargerModelVerdict(Q_SuperchargerModelVerdict);
        model.setQ_CanisterModel(Q_CanisterModel);
        model.setQ_CanisterModelVerdict(Q_CanisterModelVerdict);
        model.setQ_EGOModel(Q_EGOModel);
        model.setQ_EGOModelVerdict(Q_EGOModelVerdict);
        model.setC_ECUModel(C_ECUModel);
        model.setC_ECUModelVerdict(C_ECUModelVerdict);
        model.setC_OilPumpModel(C_OilPumpModel);
        model.setC_OilPumpModelVerdict(C_OilPumpModelVerdict);
        model.setC_InjectionModel(C_InjectionModel);
        model.setC_InjectionModelVerdict(C_InjectionModelVerdict);
        model.setC_RailModel(C_RailModel);
        model.setC_RailModelVerdict(C_RailModelVerdict);
        model.setC_SuperchargerModel(C_SuperchargerModel);
        model.setC_SuperchargerModelVerdict(C_SuperchargerModelVerdict);
        model.setC_EGRModel(C_EGRModel);
        model.setC_EGRModelVerdict(C_EGRModelVerdict);
        model.setC_DOCModel(C_DOCModel);
        model.setC_DOCModelVerdict(C_DOCModelVerdict);
        model.setC_POCModel(C_POCModel);
        model.setC_POCModelVerdict(C_POCModelVerdict);
        model.setC_SCRModel(C_SCRModel);
        model.setC_SCRModelVerdict(C_SCRModelVerdict);
        model.setC_DPFModel(C_DPFModel);
        model.setC_DPFModelVerdict(C_DPFModelVerdict);
        model.setC_ASCModel(C_ASCModel);
        model.setC_ASCModelVerdict(C_ASCModelVerdict);
        model.setListVerdict(ListVerdict);
        model.setControlVerdict(ControlVerdict);
        Gson gson = new Gson();
        String jsonStr = gson.toJson(model);
        String logStr = "环保--保存公开信息----jsonStr===" + jsonStr + "\n" + "URL::" + SharedPreferencesUtils.getIP(this) + INSERT_PUBLIC_INFO;
        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
        OkGo.<String>post(SharedPreferencesUtils.getIP(this) + INSERT_PUBLIC_INFO).tag(this)
                .upJson(jsonStr)
                .execute(new StringCallback() {
                    @Override
                    public void onStart(Request<String, ? extends Request> request) {
                        super.onStart(request);
                    }

                    @Override
                    public void onSuccess(Response<String> response) {
                        String result = response.body();
                        String newResult = result.substring(1, result.length() - 1).replaceAll("\\\\", "");
                        String logStr = "环保--保存公开信息--请求成功---result::" + result + "\n" + "newResult::" + newResult;
                        Log.e("tag", logStr);
                        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
//                        if (!TextUtils.isEmpty(newResult) && !"[[]]".equals(newResult) && !"[{}]".equals
//                                (newResult) && !"[]".equals(newResult)) {
//                            Toast.makeText(instances, newResult, Toast.LENGTH_LONG).show();
//                        }
                        Toast.makeText(instances, "环保公开信息保存成功", Toast.LENGTH_LONG).show();
                        finish();
                    }

                    @Override
                    public void onError(Response<String> response) {
                        super.onError(response);
                        String logStr = "\n" + "-----环保--保存公开信息--请求失败--onError-" + "\n"
                                + "data::" + response.body();
                        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());
                        UtilsLog.e(instances.getClass().getName() + "保存公开信息-onError==" + response.body());
                        Toast.makeText(instances, "保存环保公开信息请求失败", Toast
                                .LENGTH_LONG).show();
                    }
                });
    }

    private class SearchModel {
        String VIN;

        public String getVIN() {
            return VIN;
        }

        public void setVIN(String VIN) {
            this.VIN = VIN;
        }

        @Override
        public String toString() {
            return "Search{" +
                    "VIN='" + VIN + '\'' +
                    '}';
        }
    }

    private String[] shi_fou_str = new String[]{"是", "否"};
    private String[] huan_verdict_str = new String[]{"/", "符合", "不符合", "不可视", "信息不可见", "无"};

    private void showHuanDialog(String[] str, final int id) {
//        BottomMenu bottomMenu= BottomMenu().build(this);
        BottomMenu.show(this, str, new OnMenuItemClickListener() {
            @Override
            public void onClick(String text, int index) {
                //返回参数 text 即菜单名称，index 即菜单索引
                switch (id) {
                    case R.id.include_huan_check_ecuModel:
                        includeHuanCheckEcuModel.setText(text);
                        break;
                    case R.id.include_huan_check_converterModel:
                        includeHuanCheckConverterModel.setText(text);
                        break;
                    case R.id.include_huan_check_bujiqiModel:
                        includeHuanCheckBujiqiModel.setText(text);
                        break;
                    case R.id.include_huan_check_tanguanModel:
                        includeHuanCheckTanguanModel.setText(text);
                        break;
                    case R.id.include_huan_check_yangchuanganqiModel:
                        includeHuanCheckYangchuanganqiModel.setText(text);
                        break;
                    case R.id.include_huan_check_egrModel:
                        includeHuanCheckEgrModel.setText(text);
                        break;
                    case R.id.include_huan_check_zengyaqiModel:
                        includeHuanCheckZengyaqiModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_ecuModel:
                        includeHuanCyCheckEcuModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_penyoubengModel:
                        includeHuanCyCheckPenyoubengModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_penyouqiModel:
                        includeHuanCyCheckPenyouqiModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_gongguiguanModel:
                        includeHuanCyCheckGongguiguanModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_zengyaqiModel:
                        includeHuanCyCheckZengyaqiModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_egrModel:
                        includeHuanCyCheckEgrModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_docModel:
                        includeHuanCyCheckDocModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_pocModel:
                        includeHuanCyCheckPocModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_scrModel:
                        includeHuanCyCheckScrModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_ascModel:
                        includeHuanCyCheckAscModel.setText(text);
                        break;
                    case R.id.include_huan_cy_check_dpfModel:
                        includeHuanCyCheckDpfModel.setText(text);
                        break;
                    case R.id.include_huan_isOpen:
                        includeHuanIsOpen.setText(text);
                        break;
                    case R.id.include_huan_checkResult:
                        includeHuanCheckResult.setText(text);
                        break;
                }
            }
        });
    }
}